package com.lemon.blog.web.controller;

import com.lemon.blog.web.domain.BlLink;
import com.lemon.blog.web.service.IBlLinkService;
import com.lemon.common.core.web.controller.BaseController;
import com.lemon.common.core.web.domain.AjaxResult;
import com.lemon.common.core.web.page.TableDataInfo;
import com.lemon.common.log.annotation.Log;
import com.lemon.common.log.enums.BusinessType;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * 包名称：com.lemon.blog.controller
 * 类名称：BlLinkController
 * 类描述：友情链接Controller
 * 创建人：@author huangpeng
 * 创建时间：2022-05-04
 */
@Api("友情链接")
@RestController
@RequestMapping("/link")
public class BlLinkController extends BaseController {

    @Autowired
    private IBlLinkService blLinkService;

    /**
     * 查询友情链接列表
     * @Title: list
     * @Description: 查询友情链接列表
     * @param blLink 友情链接
     * @return: TableDataInfo
     * @throws:
     * @author: huangpeng
     * @Date: 2022-05-04
     */
    @GetMapping("/queryAll")
    public AjaxResult list(BlLink blLink) {
        List<BlLink> list = blLinkService.selectBlLinkList(blLink);
        return AjaxResult.success(list);
    }

    /**
     * 新增友情链接
     * @Title: add
     * @Description: 新增友情链接
     * @param blLink 友情链接
     * @return: AjaxResult
     * @throws:
     * @author: huangpeng
     * @Date: 2022-05-04
     */
    @Log(title = "友情链接", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BlLink blLink)
    {
        return toAjax(blLinkService.insert(blLink));
    }
}
